home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Juegos Flash / bk.dcr / game_21_lib.ls < prev    next >
Encoding:
Text File  |  2003-02-28  |  5.2 KB  |  76 lines

  1. on makemovablerb theworld, hvk, modelname, omosa, atari, hanpatsu, masatsu
  2.   theworld.model(modelname).addModifier(#meshDeform)
  3.   therigidbody = hvk.makemovablerigidbody(modelname, omosa, atari)
  4.   therigidbody.restitution = hanpatsu
  5.   therigidbody.friction = masatsu
  6. end
  7.  
  8. on makefixedrb theworld, hvk, modelname, atari, hanpatsu, masatsu
  9.   theworld.model(modelname).addModifier(#meshDeform)
  10.   therigidbody = hvk.makefixedrigidbody(modelname, atari)
  11.   therigidbody.restitution = hanpatsu
  12.   therigidbody.friction = masatsu
  13. end
  14.  
  15. on makeangulardp hvk, modelname, dpkaiten, str, damp
  16.   newdp = hvk.makeangulardashpot(modelname, modelname)
  17.   newdp.rotation = dpkaiten
  18.   newdp.strength = str
  19.   newdp.damping = damp
  20. end
  21.  
  22. on getcurrentfwd theworld, modelname, modeltransform
  23.   modeltransform.position = vector(0, 0, 0)
  24.   modeltransform.scale = vector(1, 1, 1)
  25.   currentfwd = modeltransform * vector(0, 1, 0)
  26.   return currentfwd
  27. end
  28.  
  29. on getcurrentspeed theworld, hvk, modelname, modeltransform
  30.   currentfwd = getcurrentfwd(theworld, modelname, modeltransform)
  31.   currentVel = hvk.rigidbody(modelname).linearvelocity
  32.   currentSpeed = currentVel.dot(currentfwd)
  33.   return currentSpeed
  34. end
  35.  
  36. on getdegree x1, y1, x2, y2
  37.   res = atan(abs(y1 - y2) / (abs(x1 - x2) + 0.0001)) * 180 / PI
  38.   res = (res * ((x2 >= x1) and (y2 < y1))) + ((180 - res) * ((x2 < x1) and (y2 < y1))) + ((180 + res) * ((x2 < x1) and (y2 >= y1))) + ((360 - res) * ((x2 >= x1) and (y2 >= y1)))
  39.   return res
  40. end
  41.  
  42. on putkeycode
  43.   put the keyCode
  44. end
  45.  
  46. on spritespace thesprite, theworld, camnumber
  47.   thevec = thesprite.camera(camnumber).spriteSpaceToWorldSpace(the mouseLoc)
  48.   theworld.model("cusor").transform.position = thevec * -0.14999999999999999 * 1.28499999999999992
  49.   theworld.model("cusor").transform.position.x = -theworld.model("cusor").transform.position.x
  50.   theworld.model("cusor").transform.position.y = -theworld.model("cusor").transform.position.y
  51. end
  52.  
  53. on setlossplayer2d theworld, player
  54.   playerList = ["player1", "player2", "cpu1", "cpu2", "cpu3"]
  55.   deleteOne(playerList, player)
  56.   theworld.model("2D_" & player & "Lost_B").transform.position = vector(0, -50, 0)
  57.   repeat with a = 1 to 4
  58.     theworld.model("2D_" & playerList[a] & "Lost_B").transform.position = vector(0, 0, -300)
  59.   end repeat
  60.   timeout("Loss2Dtimer").new(2000, #loss2dtimeout)
  61. end
  62.  
  63. on loss2dtimeout
  64.   member("stage").model("2D_player1Lost_B").transform.position = vector(0, 0, -300)
  65.   member("stage").model("2D_player2Lost_B").transform.position = vector(0, 0, -300)
  66.   member("stage").model("2D_cpu1Lost_B").transform.position = vector(0, 0, -300)
  67.   member("stage").model("2D_cpu2Lost_B").transform.position = vector(0, 0, -300)
  68.   member("stage").model("2D_cpu3Lost_B").transform.position = vector(0, 0, -300)
  69.   timeout("Loss2Dtimer").forget()
  70. end
  71.  
  72. on setuvlist
  73.   uv_list = [#uv2d_0: [[0.125, 0.745], [0.25, 0.505], [0.25, 0.745], [0.125, 0.505]], #uv2d_1: [[0.01, 0.98999999999999999], [0.1196, 0.76000000000000001], [0.1196, 0.98999999999999999], [0.01, 0.76000000000000001]], #uv2d_2: [[0.13, 0.98999999999999999], [0.25, 0.76000000000000001], [0.25, 0.98999999999999999], [0.13, 0.76000000000000001]], #uv2d_3: [[0.25, 0.98999999999999999], [0.37, 0.76000000000000001], [0.37, 0.98999999999999999], [0.25, 0.76000000000000001]], #uv2d_4: [[0.38, 0.98999999999999999], [0.5, 0.76000000000000001], [0.5, 0.98999999999999999], [0.38, 0.76000000000000001]], #uv2d_5: [[0.5, 0.98999999999999999], [0.625, 0.76000000000000001], [0.625, 0.98999999999999999], [0.5, 0.76000000000000001]], #uv2d_6: [[0.625, 0.98999999999999999], [0.75, 0.76000000000000001], [0.75, 0.98999999999999999], [0.625, 0.76000000000000001]], #uv2d_7: [[0.755, 0.98999999999999999], [0.87, 0.76000000000000001], [0.87, 0.98999999999999999], [0.755, 0.76000000000000001]], #uv2d_8: [[0.88, 0.98999999999999999], [0.997, 0.76000000000000001], [0.997, 0.98999999999999999], [0.88, 0.76000000000000001]], #uv2d_9: [[0.01, 0.745], [0.1196, 0.505], [0.1196, 0.745], [0.01, 0.505]], #uv2d_yellow: [[0.5, 0.0], [0.5, 0.125], [0.0, 0.0], [0.0, 0.125]], #uv2d_red: [[0.5, 0.125], [0.5, 0.25], [0.0, 0.125], [0.0, 0.25]], #uv2d_blue: [[0.995, 0.125], [0.995, 0.25], [0.505, 0.125], [0.505, 0.25]], #uv2d_green: [[0.995, 0.0], [0.995, 0.125], [0.505, 0.0], [0.505, 0.125]], #uv2d_player1: [[0.995, 0.5], [0.995, 0.625], [0.505, 0.5], [0.505, 0.625]], #uv2d_player2: [[0.0, 0.5], [0.0, 0.38], [0.5, 0.38], [0.5, 0.5]], #uv2d_cpu1: [[0.505, 0.5], [0.505, 0.38], [0.995, 0.38], [0.995, 0.5]], #uv2d_cpu2: [[0.005, 0.38], [0.005, 0.25], [0.505, 0.25], [0.505, 0.38]], #uv2d_cpu3: [[0.505, 0.38], [0.505, 0.25], [0.995, 0.25], [0.995, 0.38]], #uv2d_lost: [[0.995, 0.625], [0.995, 0.75], [0.505, 0.625], [0.505, 0.75]], #uv2d_time: [[0.5, 0.57140000000000002], [0.5, 0.68379999999999996], [0.25, 0.68379999999999996], [0.25, 0.57140000000000002]], #uv2d_1st: [[0.25, 0.38500000000000001], [0.25, 0.48999999999999999], [0.0, 0.38500000000000001], [0.0, 0.48999999999999999]], #uv2d_2nd: [[0.5, 0.38500000000000001], [0.5, 0.48999999999999999], [0.25, 0.38500000000000001], [0.25, 0.48999999999999999]], #uv2d_3rd: [[0.75, 0.38500000000000001], [0.75, 0.48999999999999999], [0.5, 0.38500000000000001], [0.5, 0.48999999999999999]], #uv2d_4th: [[1.0, 0.38500000000000001], [1.0, 0.48999999999999999], [0.75, 0.38500000000000001], [0.75, 0.48999999999999999]]]
  74.   return uv_list
  75. end
  76.